<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>ajax</title>
    <script src="static/js/jquery.js"></script>
</head>
<body>
<div>
    <button id="ajaxDemo">111</button>
    <button id="ajaxParam">222</button>
</div>
<div id="data">中华小当家</div>
<script>
    $(function () {
        $.ajax({
            url:"/data",
            dataType:"json",
            success:function (data) {
                $("#data").text(JSON.stringify(data));
            }
        })
    });

    $("#ajax").click(function () {
        $.ajax("/ajax",{
            dataType:"json",
            data:{
                id:1,
            },
            success:function (data) {
                $("#data").text(JSON.stringify(data));
            }
        })
    });
</script>
</body>
</html>